<template>
  <div class="item">
    <div ref="fontColor" class="font"
    :class="className"
    >
      <slot><span class="icon-coin-dollar"></span></slot>
    </div>
    <p class="title">新增人数</p>
    <p ref="numberRef"
       class="number"

    >100</p>
  </div>
</template>

<script>

export default {
  name: 'FontBox',
  props: ['type'],
  data: function() {
    return {
      className: ''
    }
  },
  methods: {},
  computed: {},
  created() {
    this.className = 'backcolor_' + this.type
  },
  mounted() {
    let element = this.$refs.fontColor
    let computedStyle = getComputedStyle(element, 'backgroundColor')
    this.$refs.numberRef.style.color = computedStyle.backgroundColor
  }
}
</script>

<style scoped>
  .item {
    width: 162px;
    height: 100px;
    box-sizing: border-box;
    float: left;
    margin: 30px 0 40px 30px;
    border: 1px #e8e5e9 solid;
    border-radius: 8px;
    position: relative;
    text-align: center;
    padding: 20px 45px;
  }
  .item .font {
    background-color: #fe787a;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: absolute;
    left: 7px;
    top: -20px;
    line-height: 40px;
    text-align: center;
    color: rgba(255, 255, 255, .7);
    font-size: 20px;
  }
  .item .font.backcolor_1 {
    background-color: #33cccc;
  }
  .item .font.backcolor_2 {
    background-color: #fbbb6e;
  }
  .item .font.backcolor_3 {
    background-color: #ec92e0;
  }
  .item .title {
    color: #333333;
    font: 16px 微软雅黑;
  }

  .item .number {
    color: #fe787a;
    font: 24px 微软雅黑;
    margin-top: 10px;
  }
</style>
